home *** CD-ROM | disk | FTP | other *** search
/ Inside Mac Games Volume 3 #12 / IMG 33 Dec 1995.iso / Important Files / MGW1Codeƒ / MGWExterns1.h < prev    next >
Text File  |  1995-06-25  |  6KB  |  112 lines

  1. //==============================================================================================\\
  2. //        -------------------------------------------------------------------------------            \\
  3. //        MGWExterns1.h version 1.0.0    copyright © 1993…1995 Jamie McCornack, john calhoun            \\
  4. //        -------------------------------------------------------------------------------            \\
  5. //         Constants and prototypes for Macintosh GameWriter 1.0.0, a training program…            \\
  6. //        …for beginning Mac game programmers. MGW1 includes MGWUtilities1.c, MGWSound1.c,…        \\
  7. //        …MGWGraphics1.c, MGWGraphicsBWLite1.c, HelloWorld.rsrc and an assortment of demo…        \\
  8. //         programs; projects HelloWorld1.π etc. and source code files HelloWorld1.c etc.            \\
  9. //         A tutorial is available in Tricks of the Mac Game Programming Gurus, published…        \\
  10. //        …by Hayden Books                                                                        \\
  11. //                                                                                                \\
  12. //        This code is offered by the copyright holders for no fee and for whatever use…            \\
  13. //        …you care to make of it, but we do hope you remember where it came from.                \\
  14. //                                                                                                \\
  15. //        Please send bug reports to MacGameDev at America OnLine.    macgamedev@aol.com            \\
  16. //        Suggestions and observations are also appreciated.                                        \\
  17. //        Updates and upgrades will be available now and then from the above e-mail address.        \\
  18. //==============================================================================================\\
  19.  
  20.  
  21. //--------------------------------------------------------------  Constants
  22.  
  23.                     // for MGWUtilities1.c
  24. // Assorted resource IDs and string indexes for alerts.
  25. #define    rRedAlertID                1000    // Alert resource constants. Used here because it's easier…
  26. #define    rRedAlertStringIDs        1000    // …to change constants than to rewite routines.
  27. #define    rYellowAlertID            1001    // Alert resource constants. Used here because it's easier…
  28. #define    rYellowAlertStringIDs    1001    // …to change constants than to rewite routines.
  29. #define kYellowExitItem            4        // The button in Yellow Alert rsrc that signals "quit game."
  30. #define    kErrOldSystem            1        // 'STR#' indicees.  You can add more error types to this…
  31. #define    kErrOldMacintosh        2        // …list so long as you add as well an additional string…
  32. #define    kErrLowMemory            3        // …to the red alert 'STR#' resource.
  33. #define    kErrNoResource            4
  34. #define    kErrNoColor                5
  35. #define    kErrNot8BitColor        6
  36. #define    kPref4BitColor            1        // 'STR#' indexes for YellowAlert().
  37. #define    kPref8BitColor            2
  38. #define    kPrefDownTo8BitColor    3
  39.  
  40.                     // for MGWSound1.c
  41. // Assorted Sound Priority constants.
  42. #define    kHighestSoundPriority        100        
  43. #define    kHighSoundPriority            80        // We'll define sound priorites from 1 to 100. You
  44. #define    kMediumSoundPriority        50        //   can use any integer, but often these predefined
  45. #define    kLowSoundPriority            20        //   constatns will do the job. One is the lowest priority
  46. #define    kLowestSoundPriority        1        //   we car to use--negative priorities are confusing.
  47. #define    kNoSoundPlaying                0        // Zero is reserved - it indicates "no sound is playing"
  48.  
  49.  
  50.  
  51. //--------------------------------------------------------------  Prototypes
  52.  
  53.                     // for MGWUtilities1.c
  54. void    CenterAlert (short    theAlertID);    // Centers the alert in the current monitor screen.
  55. void    RedAlert (short    whatGives);            // Display Alert message, get user ok, exit program.
  56. void    YellowAlert (short    whatGives);        // Display Alert message, get user choice, exit or…
  57.                                             // …continue program.
  58. void    RedAlertString (StringPtr    theString);    // Display Alert message, get ok, exit program.
  59. void    YellowAlertString (StringPtr theString);    //Display Alert message, get  choice, exit or…
  60.                                             // …continue program.
  61. void     InitToolbox (void);
  62. short     WhatsOurDepth (void);
  63.  
  64.                     // for MGWSound1.c
  65. // These routines handles environment launch and exit.
  66. void    InitializeForSound(void);
  67. OSErr     CloseDownSound(void);
  68.  
  69. // These routines handle sound loading at the beginning of the program.
  70. Boolean    LoadASound(short soundID);
  71. Boolean    LoadARangeOfSounds(short firstID, short lastID);
  72. Boolean    LoadAllSounds(void);
  73.  
  74. // These routines free the memory that the last group locked away. These routines do not relocate
  75. // or dispose of the sounds, but allow the memory manager to do so if heap space gets tight.
  76. Boolean    ReleaseASound(short soundID);
  77. Boolean ReleaseARangeOfSounds(short firstID, short lastID);
  78. Boolean    ReleaseAllSounds(void);
  79.  
  80. // The next group are "utility" routines that give you information about the state of sound.
  81. Boolean    IsSoundOn(void);
  82. Boolean    ASoundIsPlaying(void);
  83. short    SoundPriorityPlaying(void);
  84. Boolean    ThisMacCanPlaySounds(void);
  85.  
  86. // The last two routines actually play the sound.
  87. OSErr    PlayASound(short soundID, short priority);
  88. OSErr    PlaySynchSound(short soundID, short priority); 
  89.  
  90. // The Feeping Creature routines. Use sparingly.
  91. OSErr    PlayLoopSound(short soundID, short priority);
  92. OSErr    PlayLoopSoundOften(short soundID, short priority, short howManyLoops);
  93. void    AddSoundToQ (short soundID);
  94.  
  95.                     // for MGWGraphics1.c
  96. void     CreateOffScreenBitMap (Rect *theRect, GrafPtr *offScreen);
  97. void     CreateOffScreenPixMap (Rect *theRect, CGrafPtr *offScreen);
  98. void     KillOffscreenBitMap (GrafPtr *wasPort);
  99. void     KillOffscreenPixMap (CGrafPtr *wasPort);
  100. void     LoadGraphic (short resID);
  101.                                             // These routines presume your mainWindow is named…
  102. void DumpScreenToWork (Rect targetRect);    // …mainWindow, and your ofscreen graphics buffer…
  103. void DumpWorkToScreen (Rect targetRect);    // …is named workCPort. Change names as needed.
  104.  
  105.                     // for MGWGraphicsBWLite1.c
  106. void CreateOffScreenBitMapLite (Rect *theRect, GrafPtr *offScreen);
  107. void LoadGraphicLite (short resID);
  108.  
  109.  
  110. //------------------------------------------------------------------------------------------\\
  111. //                                    End MGWExterns1.c                                        \\
  112. //------------------------------------------------------------------------------------------\\